#include <iostream>

using namespace std;
#include <fstream>
#include <string>
int main()
{
    const int NUM_ELMTS = 18;

	// netID, major and GPA are parallel arrays
	int netID[NUM_ELMTS]; // Original netID array
	string major[NUM_ELMTS]; // Original major array
	double GPA[NUM_ELMTS]; // Original GPA array

						   // sortedGPAbyGPA is sorted by GPA, and sortedNetIDbyGPA and sorted.MajorbyGPA are parallel arrays
	double sortedGPAbyGPA[NUM_ELMTS]; // GPA array, sorted by GPA
	int sortedNetIDbyGPA[NUM_ELMTS];
	string sortedMajorbyGPA[NUM_ELMTS];

	// sortedNetIDbyID is sorted by netID, and sorted.Major by ID and sortedGPAbyID are parallel arrays
	int sortedNetIDbyID[NUM_ELMTS]; // netID array,sorted by netID
	string sortedMajorbyID[NUM_ELMTS];
	double sortedGPAbyID[NUM_ELMTS];
	int option; //Menu option

	string filename;
	int index;
	int index2;

	cout << "Enter the file name: " << endl;
	cin >> filename;

	ifstream infile(filename);
	if (infile.is_open())
	{
		while (infile)
		{
			int index = 0;
			infile >> netID[index] >> major[index] >> GPA[index];
			// Here, I am telling the compiler to read the data just like this
			// The data will be stored into subsequent arrays
			cout << netID << " " << major << " " << GPA << " ";
			index++;
			//cout << line << '\n';
		}
		cout << index;
		infile.close();
	}

	else cout << "Could not open file " << "\n Exiting" << endl;
	//Menu
	do
	{
		cout << " The purpose of this program is to manage student records" << endl << "Please select a menu option" << endl;
		cout << "1.List the top n students" << endl << "2.Search for a student" << endl << "3.Exit the program" << endl;
		cin >> option;
		switch (option)
		{
		case 1://List the top n students
			break;
		case 2://Search for a student
			break;
		case 3://Exit the program
			cout << "Exiting \n";
			return 0;
		default:
			cout << "That option is not valid";

		}
	} while (option != '3');
	//Displays arrays through a loop of index
	for (int i=0; i<index2; i++)
	{
	cout<<netID[i];
	}
	for (int i = 0; i < index2; i++)
	{
		cout << major;
	}
	for (int i = 0; i < index2; i++) {
		cout << GPA;
	}

	system("pause");
    return 0;
}

